export const save_memory = (mem_type:number,uuid:any,
                            mem_list_str:any) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "mem_type":mem_type,
        "uuid":uuid,
        "mem_list_str":mem_list_str,
        "token":token
    }
    return api({
        url: '/memory/save_memory',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const update_memory = (mem_type:number,_id:any,
                              mem_str:any) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "mem_type":mem_type,
        "_id":_id,
        "mem_str":mem_str,
        "token":token
    }
    return api({
        url: '/memory/update_memory',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const delet_memory = (mem_type:number,_id:any) => {
    return api({
        url: '/memory/delet_memory',
        method: 'get',
        params: { mem_type,_id },
    })
}

export const getMemoryDataList = (mem_type:number,uuid:any) => {
    return api({
        url: '/memory/getMemoryDataList',
        method: 'get',
        params: { mem_type,uuid },
    })
}

export const create_group = (group_name:any,group_desc:any,group_img:any) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "group_name":group_name,
        "group_desc":group_desc,
        "group_img":group_img,
        "token":token
    }
    return api({
        url: '/friends/create_group',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const update_group = (group_id:number,group_name:any,group_desc:any) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "group_id":group_id,
        "group_name":group_name,
        "group_desc":group_desc,
        "token":token
    }
    return api({
        url: '/friends/update_group',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const delet_group = (group_id:number) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "group_id":group_id,
        "token":token
    }
    return api({
        url: '/friends/delet_group',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const getGroupDataList = () => {
    return api({
        url: '/friends/getGroupDataList',
        method: 'get',
        params: { },
    })
}

export const add_group_member = (group_id:number,member_type:number,mapping_id:number) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "group_id":group_id,
        "member_type":member_type,
        "mapping_id":mapping_id,
        "token":token
    }
    return api({
        url: '/friends/add_group_member',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const update_group_member = (member_id:number,member_desc:any) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "member_id":member_id,
        "member_desc":member_desc,
        "token":token
    }
    return api({
        url: '/friends/update_group_member',
        method: 'post',
        data: JSON.stringify(params),
    })
}


export const delet_group_member = (member_id:number) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "member_id":member_id,
        "token":token
    }
    return api({
        url: '/friends/delet_group_member',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const getGroupMemberDataList = (group_id:number) => {
    return api({
        url: '/friends/getGroupMemberDataList',
        method: 'get',
        params: { group_id },
    })
}

export const get_tags_data = (uuid:any) => {
    return api({
        url: '/right/get_tags_data',
        method: 'get',
        params: { uuid },
    })
}

export const get_service_count_data = (uuid:any) => {
    return api({
        url: '/right/get_service_count_data',
        method: 'get',
        params: { uuid },
    })
}

export const ai_fill = (content_front:any,content_back:any,prompt:any,knowledge_ids:any) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "content_front":content_front,
        "content_back":content_back,
        "prompt":prompt,
        "knowledge_ids":knowledge_ids,
        "token":token
    }
    return api({
        url: '/file/ai_fill',
        method: 'post',
        data: JSON.stringify(params),
    })
}


export const ai_repair = (content_front:any,content_back:any,content_curr:any,prompt:any,knowledge_ids:any) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "content_front":content_front,
        "content_back":content_back,
        "content_curr":content_curr,
        "prompt":prompt,
        "knowledge_ids":knowledge_ids,
        "token":token
    }
    return api({
        url: '/file/ai_repair',
        method: 'post',
        data: JSON.stringify(params),
    })
}

export const payAppStoreUserData = (buyer_user_package_id:number,create_user_package_id:number,
                                    app_id:number,app_title:any,app_description:any,category_tag:any,agent_knowledge_months:number,
                                    agent_sensitive_months:number
) => {
    const token = sessionStorage.getItem('token')
    const params = {
        "buyer_user_package_id":buyer_user_package_id,
        "create_user_package_id":create_user_package_id,
        "app_id":app_id,
        "app_title":app_title,
        "app_description":app_description,
        "category_tag":category_tag,
        "agent_knowledge_months":agent_knowledge_months,
        "agent_sensitive_months":agent_sensitive_months,
        "token":token
    }
    return api({
        url: '/app_store/payAppStoreUserData',
        method: 'post',
        data: JSON.stringify(params),
    })
}
